<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Whisper: properties_reader.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Whisper
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">properties_reader.h</div>  </div>
</div>
<div class="contents">
<a href="properties__reader_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __PROPERTIES_READER_H__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __PROPERTIES_READER_H__ 1</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;ostream&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="keyword">typedef</span> std::map&lt;std::string, std::string&gt; TSection;
<a name="l00010"></a>00010 <span class="keyword">typedef</span> std::map&lt;std::string, TSection*&gt; TSections;
<a name="l00011"></a>00011 <span class="keyword">typedef</span> std::map&lt;std::string, std::map&lt;std::string, std::string&gt;*&gt;::const_iterator TSectionIterator;
<a name="l00012"></a>00012 <span class="keyword">typedef</span> std::map&lt;std::string, std::string&gt;::const_iterator TKeyIterator;
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="keyword">typedef</span> <span class="keyword">enum</span> 
<a name="l00015"></a>00015 {
<a name="l00016"></a>00016         OPEN_UNKNOWN = 0x00,
<a name="l00017"></a>00017         OPEN_NOAUTOLOAD = 0x01,
<a name="l00018"></a>00018         OPEN_AUTOLOAD = 0x02,
<a name="l00019"></a>00019 } EOpenFlags;
<a name="l00020"></a>00020 
<a name="l00028"></a>00028 <span class="keyword">class </span><a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030 <span class="keyword">public</span>:
<a name="l00031"></a>00031         <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>(<span class="keyword">const</span> std::string&amp; pFilename, EOpenFlags pFlags = OPEN_AUTOLOAD);
<a name="l00032"></a>00032         <span class="keyword">virtual</span> ~<a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>();
<a name="l00033"></a>00033 
<a name="l00041"></a>00041         <span class="keywordtype">bool</span> createSection(<span class="keyword">const</span> std::string&amp; pSection);
<a name="l00042"></a>00042 
<a name="l00049"></a>00049         <span class="keywordtype">bool</span> containsSection(<span class="keyword">const</span> std::string&amp; pSection);
<a name="l00050"></a>00050 
<a name="l00059"></a>00059         <span class="keywordtype">bool</span> containsKey(<span class="keyword">const</span> std::string&amp; pSection, <span class="keyword">const</span> std::string&amp; pKey);
<a name="l00060"></a>00060 
<a name="l00069"></a>00069         <span class="keywordtype">bool</span> getValue(<span class="keyword">const</span> std::string&amp; pSection, <span class="keyword">const</span> std::string&amp; pKey,
<a name="l00070"></a>00070                         std::string&amp; pValue);
<a name="l00071"></a>00071 
<a name="l00083"></a>00083         <span class="keywordtype">bool</span> setValue(<span class="keyword">const</span> std::string&amp; pSection, <span class="keyword">const</span> std::string&amp; pKey,
<a name="l00084"></a>00084                         <span class="keyword">const</span> std::string&amp; pValue);
<a name="l00085"></a>00085         
<a name="l00097"></a>00097         <span class="keywordtype">bool</span> createKey(<span class="keyword">const</span> std::string&amp; pSection,
<a name="l00098"></a>00098                         <span class="keyword">const</span> std::string&amp; pKey, <span class="keyword">const</span> std::string&amp; pValue);
<a name="l00099"></a>00099 
<a name="l00105"></a>00105         <span class="keywordtype">void</span> changeFile(<span class="keyword">const</span> std::string&amp; pFilename);
<a name="l00106"></a>00106 
<a name="l00112"></a>00112         <span class="keywordtype">void</span> dump(std::ostream&amp; pOut);
<a name="l00113"></a>00113 
<a name="l00119"></a>00119         <span class="keywordtype">bool</span> write();
<a name="l00120"></a>00120 
<a name="l00129"></a>00129         <span class="keywordtype">bool</span> loadIniFile();
<a name="l00130"></a>00130 
<a name="l00131"></a>00131         <span class="keywordtype">bool</span> getSectionIteratorBegin(TSectionIterator&amp; pIterator);
<a name="l00132"></a>00132         <span class="keywordtype">bool</span> getSectionIteratorEnd(TSectionIterator&amp; pIterator);
<a name="l00133"></a>00133         <span class="keywordtype">bool</span> getKeyIteratorBegin(std::string pSection, TKeyIterator&amp; pIterator);
<a name="l00134"></a>00134         <span class="keywordtype">bool</span> getKeyIteratorEnd(std::string pSection, TKeyIterator&amp; pIterator);
<a name="l00135"></a>00135 
<a name="l00139"></a>00139         <span class="keywordtype">void</span> dropConfig();
<a name="l00140"></a>00140 
<a name="l00141"></a>00141         <span class="keyword">inline</span> <span class="keywordtype">void</span> setLoaded(<span class="keywordtype">bool</span> pLoaded) { mLoaded = pLoaded; }
<a name="l00142"></a>00142         <span class="keyword">inline</span> <span class="keywordtype">bool</span> getLoaded()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mLoaded; }
<a name="l00143"></a>00143 
<a name="l00144"></a>00144 
<a name="l00145"></a>00145 <span class="keyword">private</span>:
<a name="l00146"></a>00146         <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>(<span class="keyword">const</span> <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>&amp; );
<a name="l00147"></a>00147         <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>&amp; );
<a name="l00148"></a>00148 
<a name="l00149"></a>00149 <span class="keyword">protected</span>:
<a name="l00150"></a>00150         <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>();
<a name="l00151"></a>00151 
<a name="l00155"></a>00155         std::string mFilename;
<a name="l00156"></a>00156 
<a name="l00161"></a>00161         TSections mSections;
<a name="l00162"></a>00162 
<a name="l00167"></a>00167         <span class="keywordtype">bool</span> mLoaded;
<a name="l00168"></a>00168 
<a name="l00172"></a>00172         EOpenFlags mFlags;
<a name="l00173"></a>00173 
<a name="l00174"></a>00174         <span class="comment">// ****************</span>
<a name="l00175"></a>00175         <span class="comment">// helper functions</span>
<a name="l00176"></a>00176         <span class="comment">// ****************</span>
<a name="l00177"></a>00177 
<a name="l00185"></a>00185         <span class="keywordtype">bool</span> getMapForSection(<span class="keyword">const</span> std::string&amp; pSection,
<a name="l00186"></a>00186                         TSection*&amp; pMap);
<a name="l00187"></a>00187 
<a name="l00196"></a>00196         <span class="keywordtype">bool</span> getValueForKey(<span class="keyword">const</span> std::string&amp; pSection, <span class="keyword">const</span> std::string&amp; pKey,
<a name="l00197"></a>00197                         std::string&amp; pValue);
<a name="l00198"></a>00198 };
<a name="l00199"></a>00199 <span class="preprocessor">#else</span>
<a name="l00200"></a><a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">00200</a> <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a> <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>;
<a name="l00201"></a>00201 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
<a name="l00202"></a>00202 
<a name="l00203"></a>00203 <span class="preprocessor">#endif // __PROPERTIES_READER_H__</span>
<a name="l00204"></a>00204 <span class="preprocessor"></span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 25 2012 22:00:39 for Whisper by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
